package com.xywl.escort.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.xywl.escort.R;
import com.xywl.escort.bean.OperationRecordResp;

import java.util.List;

public class OperationRecordAdapter extends BaseQuickAdapter<OperationRecordResp.DataBean.ListBean, BaseViewHolder> {
    public OperationRecordAdapter(int layoutResId, @Nullable List<OperationRecordResp.DataBean.ListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, OperationRecordResp.DataBean.ListBean item) {
        helper.setText(R.id.text_time, item.createTime);
        // 类型：1-认购，2-收购，3-发货
        switch (item.logType) {
            case 1: {
                helper.setText(R.id.text_type, "认购");
            }
            break;
            case 2: {
                helper.setText(R.id.text_type, "收购");
            }
            break;
            case 3: {
                helper.setText(R.id.text_type, "发货");
            }
            break;
            default: {
                helper.setText(R.id.text_type, "认购");
            }
            break;
        }
        helper.setText(R.id.text_change_num, item.changeNum + "份");
        // 状态：1-进行中，2-成功，3-失败
        switch (item.logStatus) {
            case 1: {
                helper.setText(R.id.text_status, "进行中");
            }
            break;
            case 2: {
                helper.setText(R.id.text_status, "成功");
            }
            break;
            case 3: {
                helper.setText(R.id.text_status, "失败");
            }
            break;
            default: {
                helper.setText(R.id.text_status, "进行中");
            }
            break;
        }
    }
}
